﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;

namespace myShop
{
    public static class Global
    {
        /* 
        
         公用类定义:用户编号，用户姓名，用户权限，连接信息，门店编号，POS号，打印机信息等
         
         */
        public static int sTIME=60;
        public static string sPayUrl = string.Empty;
        public static string sOrdUrl = string.Empty; 

        public static ArrayList SQLList = new ArrayList();

        public static string m_server = string.Empty;
        public static string m_userid = string.Empty;
        public static string m_password = string.Empty;
        public static string m_database = string.Empty;
        public static string m_port = string.Empty;

        public static string o_server = string.Empty;
        public static string o_userid = string.Empty;
        public static string o_password = string.Empty;
        public static string o_database = string.Empty;
        public static string o_port = string.Empty;

        public static string i_debug = "0";
        public static string i_exp = "3";

        public static void doGetINI()
        {
            string str = System.Environment.CurrentDirectory + "\\eShop.ini";
            if (!File.Exists(str)){
                Console.WriteLine("");
                return;
            }

            IniFile ini = new IniFile(str);
            m_server = ini.IniReadValue("MYSQL", "SCHost");
            m_port = ini.IniReadValue("MYSQL", "SCPort");
            m_userid = ini.IniReadValue("MYSQL", "SCUser");
            m_password = ini.IniReadValue("MYSQL", "SCPWD");
            m_database = ini.IniReadValue("MYSQL", "ORA");

            o_server = ini.IniReadValue("DB", "SCHost");
            o_port = ini.IniReadValue("DB", "SCPort");
            o_userid = ini.IniReadValue("DB", "SCUser");
            o_password = ini.IniReadValue("DB", "SCPWD");
            o_database = ini.IniReadValue("DB", "ORA");

            string iTime = ini.IniReadValue("ConnInfo", "ProcTime");
            sTIME = Convert.ToInt16(iTime);

            sPayUrl = ini.IniReadValue("ConnInfo", "PayUrl");
            sOrdUrl = ini.IniReadValue("ConnInfo", "OrdUrl");
            i_debug = ini.IniReadValue("ConnInfo", "Debug");
            i_exp   = ini.IniReadValue("ConnInfo", "Exp");
        }

    }
}
